#include<vector>
#include<string>
#include<iostream>
#include<algorithm>
using namespace std;
class  Resource 
{
public:
	int _r1;
	int _r2;
	int _r3;
	Resource(int r1, int r2, int r3)
	:_r1(r1),_r2(r2),_r3(r3)
	{}
	Resource() 
	{}
	bool operator < (const Resource& resource) 
	{
		return !(_r1 > resource._r1 || _r2 > resource._r2 || _r3 > resource._r3);
	}
	Resource operator+(const Resource & resource)
	{
		Resource tmp;
		tmp._r1 = _r1+ resource._r1;
		tmp._r2 = _r2 + resource._r2;
		tmp._r3 = _r3 + resource._r3;
		return tmp;
	}
	Resource operator-(const Resource& resource)
	{
		Resource tmp;
		tmp._r1 = _r1 - resource._r1;
		tmp._r2 = _r2 - resource._r2;
		tmp._r3 = _r3 - resource._r3;
		return tmp;
	}
	friend ostream& operator << (ostream& out,  const Resource& r) // iostream
	{
		out << r._r1 << " " << r._r2 << " " << r._r3;
		return out;
	}
};

typedef class Process 
{
public:
	string _process_name;
	Resource _need_max; // 最大需求量
	Resource _allocation;
	Resource _also_need; // 还需要的量
	
	static Resource _work;
	static  Resource _all; // 每种资源的总量
	Process(string name, int a, int b, int c, int m, int n, int q)
		:_process_name(name), _need_max(a, b, c), _allocation(m, n, q), _also_need(a - m, b - n, c - q)
	{}
	static ostream& operator << (ostream& out, const Process& p) // iostream
	{
		out << "进程名: " << p._process_name << endl;
		out << "最大需求量: " << p._need_max << endl;
		out << "已分配资源: " << p._allocation << endl;
		out << "还需要的资源: " << p._also_need << endl;
		return out;
	}
}PCB;
Resource Process::_work = {0,0,0};
Resource Process::_all = { 0,0,0 };
void init() 
{

}